//
//  ScanningView.swift
//  二维码扫描
//
//  Created by apple on 2021/6/8.
//

import SwiftUI

struct ScanningView: View {
    
    @State var functionType: FunctionType
    @Environment(\.presentationMode) var presentationMode
    
    private var title: String {
        switch functionType {
        case .takingPictures:
            return "拍照"
        case .video:
            return  "录像"
        case .qrCode:
            return "二维码"
        }
    }
    
    var body: some View {
        VStack {
            HStack {
                HStack {
                    Button("返回") {
                        
                        self.presentationMode.wrappedValue.dismiss()
                    }
                    Spacer()
                }
                HStack{
                    Text(title)
                    Spacer()
                }
            }
            Spacer()
        }
    }
}

struct ScanningView_Previews: PreviewProvider {
    static var previews: some View {
        ScanningView(functionType: FunctionType.qrCode)
    }
}
